package com.sinodata.bsm.center.engine.event.worker;

import com.sinodata.bsm.center.bean.ResBean;
import com.sinodata.bsm.center.engine.event.EventWorker;
import com.sinodata.bsm.center.engine.notify.NotifyEngine;
import com.sinodata.bsm.common.constants.EventConstants;
import com.sinodata.bsm.common.vo.Event;

/**
 * 
 * <p>
 * Description: 事件处理工作流：发送事件通知
 * </p>
 *
 * @author liulibo
 * @version 1.0

 * <p>
 * History: 
 *
 * Date                     Author         Version     Description
 * ---------------------------------------------------------------------------------
 * 2012-5-25 PM 4:24:22     liulibo        1.0         To create
 * </p>
 *
 * @since 
 * @see
 */
public class NotifyWorker implements EventWorker {

    public NotifyWorker() {

    }

    @Override
    public void execute(Event event) {
        ResBean resBean = ResBean.get(event.getResId());
        //恢复事件和新事件进入通知引擎
        //资源为空或删除标记位为1则不发通知
        if ((event.getCatalog() == EventConstants.CATALOG_REFAULTEVENT || event.getStatus() == EventConstants.STATUS_NEW) && (resBean != null && resBean.res().getDeleted() != 1)) {
            NotifyEngine.notify(event);
        }
    }

}